home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
R-Shows
/
(c)woc x 92a.d64
/
funct machine.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
6KB
|
208 lines
3 POKE56,127:POKE56576,149:POKE53272,4:POKE648,128:POKE792,116:POKE793,164:CLR
5 POKE53280,9:POKE53281,9
11 PRINT"[147][158] [207][183][167] [165][167][205] [165] [206][163] [183][207] [167] [206][205] [167][205] [165]
12 [153]" (null) THEN FNTHEN (null)FN (null)TO FN THEN (null)(null) THEN (null)FN
13 PRINT" [163][163] [164][164]
14 [153]" THEN(null)(null)FN (null)(null) (null)TAB( (null)SQR THEN THEN(null) FN (null)
15 PRINT" [167] [165] [207][208] [205][164] [207][208] [167] [167] [205][165] [204][175]
20 [153],"DEF BY
25 PRINT," PETE ROWE
30 [153]"SYS ADAPTED FOR THE COMMODORE 64
32 PRINT," BY
34 [153],"DEFSTEVEN DARNOLD
36 PRINT,"P.O. BOX 201
38 [153],"ALEXANDRA, NEW ZEALAND";
40 [129]I[178]1[164]4000:[130]
50 [153]"LOADSYSYOU HAVE JUST DISCOVERED A STRANGE
52 PRINT"MACHINE. IT TAKES NUMBERS, CHEWS THEM
54 [153]"UP AND SPITS THEM OUT. THE NUMBERS THAT
56 PRINT"COME OUT ARE VERY DIFFERENT FROM THE
58 [153]"NUMBERS THAT GO IN."
60 [153]"DEFHOWEVER, THE MACHINE IS NOT RANDOM.
65 PRINT"IT USES A RULE TO PROCESS THE NUMBERS."
67 PRINT"[158]YOUR MISSION IS TO FIGURE OUT THE RULE
70 [153]"SO THAT YOU CAN PREDICT WHAT THE MACHINE
72 PRINT"WILL DO.":GOSUB4000
75 PRINT"[147][150]YOU WIN WHEN YOU MAKE THREE CORRECT
77 [153]"PREDICTIONS IN A ROW. THE MACHINE WILL
80 PRINT"THEN START AGAIN WITH A DIFFERENT RULE.":GOSUB4000:POKE53265,11
100 DIM A$(2),B$(13),C$(3),R$(15),M(20)
105 F=1:Z=0:VL=-1
110 A$(0)=" [145] [157][157][157][157][157][157][209][145][206][145][206][205][205][215][145][145]"
120 A$(1)=" [145] [145][145][157][157][157][157][157][157][157][215][192][192][174][176][192][192][209]"
130 A$(2)=" [157][157][157][157][157][157][157][145][145][209][205][205][206][145][206][145][215]"
140 D$=""
145 E$=""
148 F$=""
150 B$(0)=" [157][157] [157][157] [157][157] [157][157] [215]"
160 B$(1)=" [157][157] [157][157] [157][157] [215][157][157][213][201]"
170 B$(2)=" [157][157] [157][157] [215][157][157][213][201][157][157][202][203]"
180 B$(3)=" [157][157] [215][157][157][213][201][157][157][202][203][157][157][215] "
190 B$(4)=" [215][157][157][213][201][157][157][202][203][157][157][215] [157][157] [215]"
200 B$(5)="[213][201][157][157][202][203][157][157][215] [157][157] [215][157][157][213][201]"
210 B$(6)="[202][203][157][157][215] [157][157] [215][157][157][213][201][157][157][202][203]"
220 B$(7)="[215] [157][157] [215][157][157][213][201][157][157][202][203][157][157][215] "
230 B$(8)=" [215][157][157][213][201][157][157][202][203][157][157][215] [157][157] [215]"
240 B$(9)="[213][201][157][157][202][203][157][157][215] [157][157] [215][157][157] "
250 B$(10)="[202][203][157][157][215] [157][157] [215][157][157] [157][157] "
260 B$(11)="[215] [157][157] [215][157][157] [157][157] [157][157] "
270 B$(12)=" [215][157][157] [157][157] [157][157] [157][157] "
280 B$(13)=" [157][157] [157][157] [157][157] [157][157] "
290 C$(0)=" [157][190][157][157][190][157][157] [157][157][188][157][157][190][157][157] [157][157][188][157][157][190][157][157][145] [157][145][172][145][172] [187][172] [187][172]"
300 C$(1)="[190][157][187][157][157] [157][157][188][157][157][190][157][157] [157][157][188][157][157][190][157][157] [157][157][145][172][157][145][188][145] [187][172] [187][172] "
310 C$(2)="[187][157] [157][157][188][157][157][190][157][157] [157][157][188][157][157][190][157][157] [157][157][188][157][157][145][188][157][145] [145][187][172] [187][172] [187]"
320 C$(3)=" [157] [157][157] [157][157] [157][157] [157][157] [157][157] [157][157] [157][157] [157][157][145] [157][145] [145] "
330 FORJ=1TO39:S$=S$+" ":NEXT
340 R$(1)="NUMBER PLUSX "
350 R$(2)="NUMBER PLUSY "
360 R$(3)=" X TIMES NUMBER"
370 R$(4)=" Y TIMES NUMBER"
380 R$(5)=R$(4)+" PLUSX "
390 R$(6)=R$(4)+" MINUSX "
400 R$(7)="NUMBER TIMES NUMBER PLUSY "
410 R$(8)="NUMBER TIMES NUMBER MINUSY "
420 R$(9)="NUMBER TIMES NUMBER PLUS NUMBER"
430 R$(10)=" X * NUMBER * NUMBER +Y "
440 R$(11)=" X * NUMBER * NUMBER -Y "
450 R$(12)=" X * NUMBER * NUMBER + NUMBER"
460 R$(13)="(NUMBER - 1) /X "
470 R$(14)=" Y * (NUMBER /X ) "
480 R$(15)="(NUMBER /X) -Y "
500 POKE53281,8:PRINT"[129][147] [146][157][157][157][223] [146][169][157][157][157]";:POKE53281,9
510 PRINT"[167] [146][165][157][157][157][167] [146][165][157][157][157][167][160][146][165][157][157][157]";
520 PRINT"[167] [146][165][157][157][157][167] [146][204][157][157][157][167] [146][157][157][163]";
530 PRINT"[163][145][145][164][157] [146][157][163][145][145][164][157] [146][157][163][145][145]";
540 PRINT"[164][157] [146][157][163][145][145][186][157] [146]";
550 PRINT"[157][208][157][145][145][145][167][145][164][164][144][186][204][157][157][145][167][165][157][157][145][144][167][165][157][157][145][129]";
560 PRINT"[144][206][205][157][157][157][206][205][157][157][157][157][157][215][209][157][157][129][164][164]";
570 PRINT"[164][164][186][166][204][157][157][157][145][167][166][165][157][157][157][145][167][166][165][157][157][157][145][167][166][165][165][157][165][157]";
580 PRINT"[156] [146][161][157][145][213][192][201][157][221][157][203][157][157][192][157][157][202][129][157][157][165][157][165]";
590 PRINT"[157][223][157] [223][157][157][146][223] [223][157][157][146][223] [223][157][157][146]";
600 PRINT"[223][169][157][157][157][157][145][165][157][157][163][157][157][163][157][157][163][157][157][163][157][157][163][157][157][163][157][157]";
610 PRINT"[163][157][157][163][157][157][163][157][157][163][157][157][163][157][157][145][167][157][145][167][157][145][167][157][145][167][157][145][167]";
620 PRINT"[145][145][213][201][213][192][201][213][201][157][157][157][157][157][157][157][202][203][202][192][203][202][203][129]";
630 PRINT"[157][157][157][157][157][157][157]ON OFF[129][146]";
640 PRINT"[158][145][145][145][145][145][145][145][145][145][145][145][145][145][145][145]IN [221] OUT";
650 PRINT"[158][157][157][157][157][157][157][157][157][157][192][192][192][192][219][192][192][192][192][157][157][157][157][157][157][157][157][157][157][157][157]";:POKE53265,27
660 FORJ=1TO17:PRINT" [221][160] [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]";:NEXT
670 W=1
680 PRINT"";F$;"HOW DIFFICULT (1=EASY...5=HARD)? [157][157][157][157][157]";
690 GOSUB 2500:V=VAL(N$)-1
700 IF V*(V-1)*(V-2)*(V-3)*(V-4)<>0THEN 680
710 A=INT(3*RND(1)+2):B=INT(10*RND(1)+3)
720 X=3*V+INT(3*RND(1))+1:IF V=X THEN 720
725 V=X
730 ONVGOSUB3000,3010,3020,3030,3040,3050,3060,3070,3080
735 IFV>9THENON(V-9)GOSUB3090,3100,3110,3120,3130,3140
740 PRINT"";F$;S$
750 PRINT"[158]-> [157][157][157][157][157][157]";:GOSUB 2500
760 IF W=1 AND N$="R" THEN 750
770 IF N$="R" THEN 3495
780 L=LEN(N$):X=VAL(N$):H$=N$
790 IF W=1 THEN 900
800 FORJ=1TOW-1:IF X=M(J) THEN 820
810 NEXT:GOTO 870
820 H=32874+40*J:FORJ=HTOH+13
830 POKE J,PEEK(J)+128:NEXT:T=TI
840 IF TI-T<150 THEN 840
850 FOR J=HTOH+13:POKE J,PEEK(J)-128
860 NEXT:GOTO 750
870 PRINT"";F$;"[158]GUESS WHAT'LL COME OUT: ";
880 GOSUB 2500:IF N$="R" THEN 3490
890 Y1=VAL(N$)
900 PRINT D$;"ON[129] OFF"
910 R=0:C=-1:Q=1:P=0:N$=H$
920 PRINT"";LEFT$(F$,W);SPC(32-L);N$
1000 C=C+1+((C=8)*4)*Q
1010 F=1-F:R=(R+1)*-(R<>2)
1040 PRINT"[144]";A$(R);"[145][145][145][145][145][145][155]";B$(C);"[157][157][157][129]";
1050 IF F=0 THEN PRINT" ";
1060 IF F=1 THEN PRINT"[167][166][165]*[129]";
1070 IF P>14 THEN PRINT"[157][157][157][157][157]";C$(R);"[129]";
1080 IF C=13 THEN 2000
1090 IF C>8 AND R=0 THEN R=2
1100 IF P<>19 THEN 1150
1110 Y=FNA(X):N$=STR$(Y):L=LEN(N$)
1120 FORJ=1TOL:IFMID$(N$,J,1)="E"THEN N$=" ?????":L=6:GOTO1150
1130 NEXTJ:IFL>6THEN N$=LEFT$(N$,6):L=6
1150 IF P-L=19 THEN Q=0:PRINT D$;"[129]ON OFF[129]";
1160 IF P<L+2 THEN POKE 32890+L-P,32
1200 P=P+1:PRINT LEFT$(D$,P+9);"";
1205 IF P>20 THEN PRINT LEFT$(E$,2*P-26);
1210 FOR J=1 TO L:I=P-J:I$=MID$(N$,L-J+1,1)
1220 IF (I<0 OR I>23)OR(I>12 AND I<21) THEN 1260
1230 PRINT I$;
1240 IF I<8 THEN PRINT"[145][157]";
1250 IF I>7 THEN PRINT"[157][157]";
1255 IF I>21 THEN PRINT"[145]";
1260 IF I=24 THEN POKE 33635-J,ASC(I$)
1265 NEXT
1270 IF I>0 AND I<15 OR I>21 THEN PRINT " ";
1280 PRINT "[146]";:GOTO 1000
2000 PRINTD$;"";C$(3)
2010 FOR J=33626TO33634:POKEJ,32:NEXT
2020 PRINT"";LEFT$(F$,W);SPC(34);N$
2025 I$=STR$(Y1):IF LEN(I$)>6THEN I$=LEFT$(I$,6)
2030 IF I$<>N$ OR W=1 THENZM=0:GOTO2100
2040 N=60:FOR J=0 TO 5:T=TI
2050 IF TI-T<18 THEN 2050
2060 REM N=113-N:POKE 59409,N:NEXT
2061 N=113-N:NEXT
2070 PRINT"";F$;"";
2080 PRINT"CORRECT":T=TI:ZM=ZM+1:IFZM=3THENW=16
2090 IF TI-T<140 THEN 2090
2100 PRINT"";F$;S$:M(W)=X:W=W+1
2110 IF W<17 THEN PRINT"";TAB(31);:GOTO 750
2120 GOTO 3500
2500 GET I$:IF I$<>""THEN 2500
2510 N$=" ":I=0:J=0:H=0
2520 T=TI
2530 GET I$:IF I$="" AND TI-T<20 THEN 2530
2540 Z=18-Z:PRINTCHR$(Z);" [146][157]";
2545 IF I$="" THEN 2520
2550 IF I$=CHR$(13) AND N$<>" " THEN 2680
2560 IF I$="R" THEN N$=" ":GOTO 2670
2570 IF I$="Q" THEN H=1:GOTO 2520
2580 IF I$="E" THEN H=H-(H=1):GOTO 2520
2590 IF I$="D" AND H=2 THEN STOP:REM SYS(845)
2600 H=0:IF I=0 AND I$="-" THEN 2670
2610 IF I$>"/" AND I$<":" THEN 2670
2620 IF J=0 AND I$="." THEN J=1:GOTO 2670
2630 IF I$<>CHR$(20) THEN 2520
2640 IF N$<>" " THEN N$=LEFT$(N$,LEN(N$)-1):PRINT"[157] [157][157]";
2650 IF N$=" " THEN 2510
2660 GOTO 2520
2670 N$=N$+I$:PRINTI$;:I=1:IF LEN(N$)<7THEN 2520
2680 PRINT" ";:N$=RIGHT$(N$,LEN(N$)-1):RETURN
3000 DEF FNA(X)=X+A:RETURN
3010 DEF FNA(X)=X+B:RETURN
3020 DEF FNA(X)=A*X:RETURN
3030 DEF FNA(X)=B*X:RETURN
3040 DEF FNA(X)=B*X+A:RETURN
3050 DEF FNA(X)=B*X-A:RETURN
3060 DEF FNA(X)=X*X+B:RETURN
3070 DEF FNA(X)=X*X-B:RETURN
3080 DEF FNA(X)=X*X+X:RETURN
3090 DEF FNA(X)=A*X*X+B:RETURN
3100 DEF FNA(X)=A*X*X-B:RETURN
3110 DEF FNA(X)=A*X*X+X:RETURN
3120 DEF FNA(X)=(X-1)/A:RETURN
3130 DEF FNA(X)=B*(X/A):RETURN
3140 DEF FNA(X)=(X/A)-B:RETURN
3490 PRINT" ";
3495 PRINT"[157][157][157][157] ";
3500 PRINT"";F$;"[129][145]THE RULE IS:"
3510 I$=R$(V):J=1
3520 IF MID$(I$,J,1)="X"THEN N=A:GOTO 3550
3530 IF MID$(I$,J,1)<>"Y"THEN 3560
3540 N=B
3550 I$=LEFT$(I$,J-1)+STR$(N)+RIGHT$(I$,LEN(I$)-J)
3560 J=J+1:IF J<=LEN(I$) THEN 3520
3570 PRINT S$;"[157][145]":PRINTI$:T=TI
3580 GET I$:IF I$<>"" THEN 3580
3590 GET I$:IF I$="" AND TI-T<400 THEN 3590
3600 PRINT"";F$;"[145]";S$
3610 PRINT"";S$;"[157][145]";:GOTO 650
4000 PRINT"[155]PRESS SHIFT[146][145][157][157][157][157][157][164][164][164][164][164] TO CONTINUE.";
4002 WAIT653,1,1:WAIT653,1:RETURN